package net;

import core.*;
import event.*;

public abstract class Server implements Plugin {
	
	public long getVersion() {
		return version;
	}


	public void setVersion(long version) {
		this.version = version;
	}


	public void load(Controller controller) {
		this.controller = controller;
	}
	
	
	public void start() {
		this.thread = new Thread(this, this.getClass().getCanonicalName());
		this.thread.start();
		controller.subscribeEvents(this);
	}
	
	
	public boolean isRunning() {
		return thread.isAlive();
	}
	
	
	public void stop() {
		controller.unsubscribeEvents(this);
	}
	
	
	public void wallEventHandler(WallEventArgs args) {	}
	public void chatEventHandler(ChatEventArgs args) {	}
	public void chatFailedEventHandler(ChatFailedEventArgs args) {	}
	public void userLoggedInEventHandler(UserLoggedInEventArgs args) {	}
	public void userLoggedOutEventHandler(UserLoggedOutEventArgs args) {	}
	public void registrationSuccessfulEventHandler(RegistrationSuccessfulEventArgs args) { }
	public void registrationFailedEventHandler(RegistrationFailedEventArgs args) { }
	public void invitationReceivedEventHandler(InvitationReceivedEventArgs args) {	}
	public void invalidInvitationReceivedEventHandler(InvalidInvitationReceivedEventArgs args) { }
	public void invitationTimedOutEventHandler(InvitationTimedOutEventArgs args) {  }
	public void invitationReplyEventHandler(InvitationReplyEventArgs args) {  }
	public void invalidInvitationReplyEventHandler(InvalidInvitationReplyEventArgs args) {  }	
	public void matchStartedEventHandler(MatchStartedEventArgs args) { }
	public void playerMoveEventHandler(PlayerMoveEventArgs args) { }
	public void invalidMoveEventHandler(InvalidMoveEventArgs args) { }
	public void listPlayersEventHandler(ListPlayersEventArgs args) { }
	public void matchEndedEventHandler(MatchEndedEventArgs args) { }
	public void loginFailedEventHandler(LoginFailedEventArgs args) { }
	public void clientPingEventHandler(ClientPingEventArgs args) { }
	public void listMatchsReplyEventHandler(ListMatchsReplyEventArgs args) { }
	public void listGamesReplyEventHandler(ListGamesReplyEventArgs args) { }
	public void invalidUserDetailsRequestEventHandler(InvalidUserDetailsRequestEventArgs args) { }
	public void userDetailsReplyEventHandler(UserDetailsReplyEventArgs args) { }
	public void accountCreationSuccessfulEventHandler(AccountCreationSuccessfulEventArgs args) { }
	public void accountCreationFailedEventHandler(AccountCreationFailedEventArgs args) { }
	public void accountEditionSuccessfulEventHandler(AccountEditionSuccessfulEventArgs args) { }
	public void accountEditionFailedEventHandler(AccountEditionFailedEventArgs args) { }
	public void accountRemotionSuccessfulEventHandler(AccountRemotionSuccessfulEventArgs args) { }
	public void accountRemotionFailedEventHandler(AccountRemotionFailedEventArgs args) { }
	public void listPluginsReplyEventHandler(ListPluginsReplyEventArgs args) { }
	public void pluginOperationFailedEventHandler(PluginOperationFailedEventArgs args) { }
	public void pluginOperationSuccessfulEventHandler(PluginOperationSuccessfulEventArgs args) { }	
	
	protected Controller controller;
	private Thread thread;
	protected long version;
}
